// components/mPop/mCheckPop.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    // isShow: true,
    isShow: false,
    disabled: true,
    second: 5
  },

  /**
   * 组件的方法列表
   */
  methods: {
    openPop: function(){
      let self = this;
      this.setData({
        isShow: true,
        second: 5
      });
      clearInterval(this.timer);
      this.timer = setInterval(function(){
        self.setData({
          second: self.data.second-1
        });
        if(self.data.second<=0){
          clearInterval(self.timer);
          self.timer = null;
          self.setData({
            disabled: false
          });
        }
      },1000);
    },
    closePop: function(){
      this.setData({
        isShow: false
      });
    },
    confirmHandle: function(){
      if(!this.data.disabled){
        this.setData({
          isShow: false,
          second: 5,
          disabled: true
        });
        this.triggerEvent('confirm');
      }
    }
  }
})
